Machine Learning RSI [BackQuant]Machine Learning RSI
The Machine Learning RSI is a cutting-edge trading indicator that combines the power of Relative Strength Index (RSI) with Machine Learning (ML) clustering techniques to dynamically determine overbought and oversold thresholds. This advanced indicator adapts to market conditions in real-time, offering traders a robust tool for identifying optimal entry and exit points with increased precision.
Core Concept: Relative Strength Index (RSI)
The RSI is a well-known momentum oscillator that measures the speed and change of price movements, oscillating between 0 and 100. Typically, RSI values above 70 are considered overbought, and values below 30 are considered oversold. However, static thresholds may not be effective in all market conditions.
This script enhances the RSI by integrating a dynamic thresholding system powered by Machine Learning clustering, allowing it to adapt thresholds based on historical RSI behavior and market context.
Machine Learning Clustering for Dynamic Thresholds
The Machine Learning (ML) component uses clustering to calculate dynamic thresholds for overbought and oversold levels. Instead of relying on fixed RSI levels, this indicator clusters historical RSI values into three groups using a percentile-based initialization and iterative optimization:
Cluster 1: Represents lower RSI values (typically associated with oversold conditions).
Cluster 2: Represents mid-range RSI values.
Cluster 3: Represents higher RSI values (typically associated with overbought conditions).
Dynamic thresholds are determined as follows:
Long Threshold: The upper centroid value of Cluster 3.
Short Threshold: The lower centroid value of Cluster 1.
This approach ensures that the indicator adapts to the current market regime, providing more accurate signals in volatile or trending conditions.
Smoothing Options for RSI
To further enhance the effectiveness of the RSI, this script allows traders to apply various smoothing methods to the RSI calculation, including:
Simple Moving Average (SMA)
Exponential Moving Average (EMA)
Weighted Moving Average (WMA)
Hull Moving Average (HMA)
Linear Regression (LINREG)
Double Exponential Moving Average (DEMA)
Triple Exponential Moving Average (TEMA)
Adaptive Linear Moving Average (ALMA)
T3 Moving Average
Traders can select their preferred smoothing method and adjust the smoothing period to suit their trading style and market conditions. The option to smooth the RSI reduces noise and makes the indicator more reliable for detecting trends and reversals.
Long and Short Signals
The indicator generates long and short signals based on the relationship between the RSI value and the dynamic thresholds:
Long Signals: Triggered when the RSI crosses above the long threshold, signaling bullish momentum.
Short Signals: Triggered when the RSI falls below the short threshold, signaling bearish momentum.
These signals are dynamically adjusted to reflect real-time market conditions, making them more robust than static RSI signals.
Visualization and Clustering Insights
The Machine Learning RSI provides an intuitive and visually rich interface, including:
RSI Line: Plotted in real-time, color-coded based on its position relative to the dynamic thresholds (green for long, red for short, gray for neutral).
Dynamic Threshold Lines: The script plots the long and short thresholds calculated by the ML clustering process, providing a clear visual reference for overbought and oversold levels.
Cluster Plots: Each RSI cluster is displayed with distinct colors (green, orange, and red) to give traders insights into how RSI values are grouped and how the dynamic thresholds are derived.
Customization Options
The Machine Learning RSI is highly customizable, allowing traders to tailor the indicator to their preferences:
RSI Settings : Adjust the RSI length, source price, and smoothing method to match your trading strategy.
Threshold Settings : Define the range and step size for clustering thresholds, allowing you to fine-tune the clustering process.
Optimization Settings : Control the performance memory, maximum clustering steps, and maximum data points for ML calculations to ensure optimal performance.
UI Settings : Customize the appearance of the RSI plot, dynamic thresholds, and cluster plots. Traders can also enable or disable candle coloring based on trend direction.
Alerts and Automation
To assist traders in staying on top of market movements, the script includes alert conditions for key events:
Long Signal: When the RSI crosses above the long threshold.
Short Signal: When the RSI crosses below the short threshold.
These alerts can be configured to notify traders in real-time, enabling timely decisions without constant chart monitoring.
Trading Applications
The Machine Learning RSI is versatile and can be applied to various trading strategies, including:
Trend Following: By dynamically adjusting thresholds, this indicator is effective in identifying and following trends in real-time.
Reversal Trading: The ML clustering process helps identify extreme RSI levels, offering reliable signals for reversals.
Range-Bound Trading: The dynamic thresholds adapt to market conditions, making the indicator suitable for trading in sideways markets where static thresholds often fail.
Final Thoughts
The Machine Learning RSI represents a significant advancement in RSI-based trading indicators. By integrating Machine Learning clustering techniques, this script overcomes the limitations of static thresholds, providing dynamic, adaptive signals that respond to market conditions in real-time. With its robust visualization, customizable settings, and alert capabilities, this indicator is a powerful tool for traders seeking to enhance their momentum analysis and improve decision-making.
As always, thorough backtesting and integration into a broader trading strategy are recommended to maximize the effectiveness!
[i]price
Dual price forecast with Projection Zone [FXSMARTLAB]The Dual Price Forecast with Projection Zone indicator is built to simulate potential future price paths based on historical price movements over two defined lookback periods. By running multiple trials (or simulations) on these historical price movements, the indicator achieves a more robust forecast, incorporating the inherent variability of price behavior.
Key Components and Calculation Details
1. Lookback Periods and Historical Price Movements
Lookback Period 1 and Lookback Period 2 specify the range of past data used to generate each projection. For each period, the indicator calculates the price variations (differences between the closing and opening prices) and stores these in arrays.
These historical price variations capture the volatility and price patterns within each period, serving as templates for future price behavior.
2. Trials: Purpose and Function
The trials are a critical element in the projection calculation. Each trial represents a single simulation of possible future price movements, derived from a random reordering of the historical price variations in each lookback period.
By running multiple trials , the indicator explores various sequences of historical movements, simulating different possible future paths. Each trial adds to the projection’s robustness by capturing a unique potential price path based on past behavior.
Running these multiple trials allows the indicator to account for randomness in price behavior, making the projections more comprehensive by covering a range of scenarios rather than relying on a single deterministic forecast.
3. Reverse Option
The reverse option allows the indicator to invert the direction of price movements within each lookback period. When enabled, historical uptrends are treated as downtrends, and vice versa.
This feature is particularly valuable in scenarios where traders expect a potential reversal in market direction. By enabling the reverse option, the indicator can simulate what might happen if past trends inverted, providing an alternative forecast path that considers possible market reversals.
This allows traders to assess both continuation and reversal scenarios, giving them a more balanced view of potential future price paths and helping them prepare for either market direction.
4. Generating the Average Projection Path
Once the trials are complete, the indicator calculates an average projected price path for each lookback period by averaging the results of all trials. This average represents the most likely price trend based on historical data and provides a smoothed projection that mitigates extreme outliers.
By averaging across all trial paths, the indicator generates a more reliable and balanced forecast line, smoothing out the fluctuations that might appear if only one trial or a small number of trials were used.
5. Projection Zone Visualization
The indicator plots the two average projection paths (one for each lookback period) as Projection 1 and Projection 2, each in a user-defined color.
The Projection Zone is the area between these two lines, filled with a semi-transparent color. This zone visually represents the potential range of future price movement, highlighting where prices are likely to oscillate if historical trends persist.
The Projection Zone effectively functions as a potential support and resistance boundary, providing traders with a visual reference for possible price fluctuations within a specific range.
6. Display of Lookback Zones
To give context to the projections, the indicator can also display colored lookback zones on the chart. These zones correspond to Lookback Period 1 and Lookback Period 2 and are color-coded to match their respective projection lines.
These zones allow traders to see the sections of historical data used in the calculation, helping them understand which past price behaviors influenced the current projections.
Benefits of the Indicator
The "Dual Price Forecast with Projection Zone" indicator provides a multi-scenario forecast based on past price dynamics. Its use of trials ensures that projections are not based on a single deterministic path but on a range of possible scenarios that better reflect the inherent randomness in financial markets.
By generating a probabilistic forecast within a defined zone, the indicator helps traders to:
Anticipate potential price ranges and areas of support/resistance based on historical trends.
Understand the influence of different timeframes (short-term and long-term lookbacks) on future price behavior.
Make informed decisions by visualizing the likely variability of future prices within a controlled projection zone.
Prepare for both continuation and reversal scenarios, thanks to the reverse option. This feature is especially useful in markets where trends may change direction, as it allows traders to explore what might happen
PDF Smoothed Moving Average [BackQuant]PDF Smoothed Moving Average
Introducing BackQuant’s PDF Smoothed Moving Average (PDF-MA) — an innovative trading indicator that applies Probability Density Function (PDF) weighting to moving averages, creating a unique, trend-following tool that offers adaptive smoothing to price movements. This advanced indicator gives traders an edge by blending PDF-weighted values with conventional moving averages, helping to capture trend shifts with enhanced clarity.
Core Concept: Probability Density Function (PDF) Smoothing
The Probability Density Function (PDF) provides a mathematical approach to applying adaptive weighting to data points based on a specified variance and mean. In the PDF-MA indicator, the PDF function is used to weight price data, adding a layer of probabilistic smoothing that enhances the detection of trend strength while reducing noise.
The PDF weights are controlled by two key parameters:
Variance: Determines the spread of the weights, where higher values spread out the weighting effect, providing broader smoothing.
Mean : Centers the weights around a particular price value, influencing the trend’s directionality and sensitivity.
These PDF weights are applied to each price point over the chosen period, creating an adaptive and smooth moving average that more closely reflects the underlying price trend.
Blending PDF with Standard Moving Averages
To further improve the PDF-MA, this indicator combines the PDF-weighted average with a traditional moving average, selected by the user as either an Exponential Moving Average (EMA) or Simple Moving Average (SMA). This blended approach leverages the strengths of each method: the responsiveness of PDF smoothing and the robustness of conventional moving averages.
Smoothing Method: Traders can choose between EMA and SMA for the additional moving average layer. The EMA is more responsive to recent prices, while the SMA provides a consistent average across the selected period.
Smoothing Period: Controls the length of the lookback period, affecting how sensitive the average is to price changes.
The result is a PDF-MA that provides a reliable trend line, reflecting both the PDF weighting and traditional moving average values, ideal for use in trend-following and momentum-based strategies.
Trend Detection and Candle Coloring
The PDF-MA includes a built-in trend detection feature that dynamically colors candles based on the direction of the smoothed moving average:
Uptrend: When the PDF-MA value is increasing, the trend is considered bullish, and candles are colored green, indicating potential buying conditions.
Downtrend: When the PDF-MA value is decreasing, the trend is considered bearish, and candles are colored red, signaling potential selling or shorting conditions.
These color-coded candles provide a quick visual reference for the trend direction, helping traders make real-time decisions based on the current market trend.
Customization and Visualization Options
This indicator offers a range of customization options, allowing traders to tailor it to their specific preferences and trading environment:
Price Source : Choose the price data for calculation, with options like close, open, high, low, or HLC3.
Variance and Mean : Fine-tune the PDF weighting parameters to control the indicator’s sensitivity and responsiveness to price data.
Smoothing Method : Select either EMA or SMA to customize the conventional moving average layer used in conjunction with the PDF.
Smoothing Period : Set the lookback period for the moving average, with a longer period providing more stability and a shorter period offering greater sensitivity.
Candle Coloring : Enable or disable candle coloring based on trend direction, providing additional clarity in identifying bullish and bearish phases.
Trading Applications
The PDF Smoothed Moving Average can be applied across various trading strategies and timeframes:
Trend Following : By smoothing price data with PDF weighting, this indicator helps traders identify long-term trends while filtering out short-term noise.
Reversal Trading : The PDF-MA’s trend coloring feature can help pinpoint potential reversal points by showing shifts in the trend direction, allowing traders to enter or exit positions at optimal moments.
Swing Trading : The PDF-MA provides a clear trend line that swing traders can use to capture intermediate price moves, following the trend direction until it shifts.
Final Thoughts
The PDF Smoothed Moving Average is a highly adaptable indicator that combines probabilistic smoothing with traditional moving averages, providing a nuanced view of market trends. By integrating PDF-based weighting with the flexibility of EMA or SMA smoothing, this indicator offers traders an advanced tool for trend analysis that adapts to changing market conditions with reduced lag and increased accuracy.
Whether you’re trading trends, reversals, or swings, the PDF-MA offers valuable insights into the direction and strength of price movements, making it a versatile addition to any trading strategy.
Savitzky-Golay Z-Score [BackQuant]Savitzky-Golay Z-Score
The Savitzky-Golay Z-Score is a powerful trading indicator that combines the precision of the Savitzky-Golay filter with the statistical strength of the Z-Score. This advanced indicator is designed to detect trend shifts, identify overbought or oversold conditions, and highlight potential divergences in the market, providing traders with a unique edge in detecting momentum changes and trend reversals.
Core Concept: Savitzky-Golay Filter
The Savitzky-Golay filter is a widely-used smoothing technique that preserves important signal features such as peak detection while filtering out noise. In this indicator, the filter is applied to price data (default set to HLC3) to smooth out volatility and produce a cleaner trend line. By specifying the window size and polynomial degree, traders can fine-tune the degree of smoothing to match their preferred trading style or market conditions.
Z-Score: Measuring Deviation
The Z-Score is a statistical measure that indicates how far the current price is from its mean in terms of standard deviations. In trading, the Z-Score can be used to identify extreme price moves that are likely to revert or continue trending. A positive Z-Score means the price is above the mean, while a negative Z-Score indicates the price is below the mean.
This script calculates the Z-Score based on the Savitzky-Golay filtered price, enabling traders to detect moments when the price is diverging from its typical range and may present an opportunity for a trade.
Long and Short Conditions
The Savitzky-Golay Z-Score generates clear long and short signals based on the Z-Score value:
Long Signals : When the Z-Score is positive, indicating the price is above its smoothed mean, a long signal is generated. The color of the bars turns green, signaling upward momentum.
Short Signals : When the Z-Score is negative, indicating the price is below its smoothed mean, a short signal is generated. The bars turn red, signaling downward momentum.
These signals allow traders to follow the prevailing trend with confidence, using statistical backing to avoid false signals from short-term volatility.
Standard Deviation Levels and Extreme Levels
This indicator includes several features to help visualize overbought and oversold conditions:
Standard Deviation Levels: The script plots horizontal lines at +1, +2, -1, and -2 standard deviations. These levels provide a reference for how far the current price is from the mean, allowing traders to quickly identify when the price is moving into extreme territory.
Extreme Levels: Additional extreme levels at +3 and +4 (and their negative counterparts) are plotted to highlight areas where the price is highly likely to revert. These extreme levels provide important insight into market conditions that are far outside the norm, signaling caution or potential reversal zones.
The indicator also adapts the color shading of these extreme zones based on the Z-Score’s strength. For example, the area between +3 and +4 is shaded with a stronger color when the Z-Score approaches these values, giving a visual representation of market pressure.
Divergences: Detecting Hidden and Regular Signals
A key feature of the Savitzky-Golay Z-Score is its ability to detect bullish and bearish divergences, both regular and hidden:
Regular Bullish Divergence: This occurs when the price makes a lower low while the Z-Score forms a higher low. It signals that bearish momentum is weakening, and a bullish reversal could be near.
Hidden Bullish Divergence: This divergence occurs when the price makes a higher low while the Z-Score forms a lower low. It signals that bullish momentum may continue after a temporary pullback.
Regular Bearish Divergence: This occurs when the price makes a higher high while the Z-Score forms a lower high, signaling that bullish momentum is weakening and a bearish reversal may be near.
Hidden Bearish Divergence: This divergence occurs when the price makes a lower high while the Z-Score forms a higher high, indicating that bearish momentum may continue after a temporary rally.
These divergences are plotted directly on the chart, making it easier for traders to spot when the price and momentum are out of sync and when a potential reversal may occur.
Customization and Visualization
The Savitzky-Golay Z-Score offers a range of customization options to fit different trading styles:
Window Size and Polynomial Degree: Adjust the window size and polynomial degree of the Savitzky-Golay filter to control how much smoothing is applied to the price data.
Z-Score Lookback Period: Set the lookback period for calculating the Z-Score, allowing traders to fine-tune the sensitivity to short-term or long-term price movements.
Display Options: Choose whether to display standard deviation levels, extreme levels, and divergence labels on the chart.
Bar Color: Color the price bars based on trend direction, with green for bullish trends and red for bearish trends, allowing traders to easily visualize the current momentum.
Divergences: Enable or disable divergence detection, and adjust the lookback periods for pivots used to detect regular and hidden divergences.
Alerts and Automation
To ensure you never miss an important signal, the indicator includes built-in alert conditions for the following events:
Positive Z-Score (Long Signal): Triggers an alert when the Z-Score crosses above zero, indicating a potential buying opportunity.
Negative Z-Score (Short Signal): Triggers an alert when the Z-Score crosses below zero, signaling a potential short opportunity.
Shifting Momentum: Alerts when the Z-Score is shifting up or down, providing early warning of changing market conditions.
These alerts can be configured to notify you via email, SMS, or app notification, allowing you to stay on top of the market without having to constantly monitor the chart.
Trading Applications
The Savitzky-Golay Z-Score is a versatile tool that can be applied across multiple trading strategies:
Trend Following: By smoothing the price and calculating the Z-Score, this indicator helps traders follow the prevailing trend while avoiding false signals from short-term volatility.
Mean Reversion: The Z-Score highlights moments when the price is far from its mean, helping traders identify overbought or oversold conditions and capitalize on potential reversals.
Divergence Trading: Regular and hidden divergences between the Z-Score and price provide early warning of trend reversals, allowing traders to enter trades at opportune moments.
Final Thoughts
The Savitzky-Golay Z-Score is an advanced statistical tool designed to provide a clearer view of market trends and momentum. By applying the Savitzky-Golay filter and Z-Score analysis, this indicator reduces noise and highlights key areas where the market may reverse or accelerate, giving traders a significant edge in understanding price behavior.
Whether you’re a trend follower or a reversal trader, this indicator offers the flexibility and insights you need to navigate complex markets with confidence.
Savitzky Golay Median Filtered RSI [BackQuant]Savitzky Golay Median Filtered RSI
Introducing BackQuant's Savitzky Golay Median Filtered RSI, a cutting-edge indicator that enhances the classic Relative Strength Index (RSI) by applying both a Savitzky-Golay filter and a median filter to provide smoother and more reliable signals. This advanced approach helps reduce noise and captures true momentum trends with greater precision. Let’s break down how the indicator works, the features it offers, and how it can improve your trading strategy.
Core Concept: Relative Strength Index (RSI)
The Relative Strength Index (RSI) is a widely used momentum oscillator that measures the speed and change of price movements. It oscillates between 0 and 100, with levels above 70 typically indicating overbought conditions and levels below 30 indicating oversold conditions. However, the standard RSI can sometimes generate noisy signals, especially in volatile markets, making it challenging to identify reliable entry and exit points.
To improve upon the traditional RSI, this indicator introduces two powerful filters: the Savitzky-Golay filter and a median filter.
Savitzky-Golay Filter: Smoothing with Precision
The Savitzky-Golay filter is a digital filtering technique used to smooth data while preserving important features, such as peaks and trends. Unlike simple moving averages that can distort important price data, the Savitzky-Golay filter uses polynomial regression to fit the data, providing a more accurate and less lagging result.
In this script, the Savitzky-Golay filter is applied to the RSI values to smooth out short-term fluctuations and provide a more reliable signal. By using a window size of 5 and a polynomial degree of 2, the filter effectively reduces noise without compromising the integrity of the underlying price movements.
Median Filter: Reducing Outliers
After applying the Savitzky-Golay filter, the median filter is applied to the smoothed RSI values. The median filter is particularly effective at removing short-lived outliers, further enhancing the accuracy of the RSI by reducing the impact of sudden and temporary price spikes or drops. This combination of filters creates an ultra-smooth RSI that is better suited for detecting true market trends.
Long and Short Signals
The Savitzky Golay Median Filtered RSI generates long and short signals based on user-defined threshold levels:
Long Signals: A long signal is triggered when the filtered RSI exceeds the Long Threshold (default set at 176). This indicates that momentum is shifting upward, and it may present a good buying opportunity.
Short Signals: A short signal is generated when the filtered RSI falls below the Short Threshold (default set at 162). This suggests that momentum is weakening, potentially signaling a selling opportunity or exit from a long position.
These threshold levels can be adjusted to suit different market conditions and timeframes, allowing traders to fine-tune the sensitivity of the indicator.
Customization and Visualization Options
The Savitzky Golay Median Filtered RSI comes with several customization options, enabling traders to tailor the indicator to their specific needs:
Calculation Source: Select the price source for the RSI calculation (default is OHLC4, but it can be changed to close, open, high, or low prices).
RSI Period: Adjust the lookback period for the RSI calculation (default is 14).
Median Filter Length: Control the length of the median filter applied to the smoothed RSI, affecting how much noise is removed from the signal.
Threshold Levels: Customize the long and short thresholds to define the sensitivity for generating buy and sell signals.
UI Settings: Choose whether to display the RSI and thresholds on the chart, color the bars according to trend direction, and adjust the line width and colors used for long and short signals.
Visual Feedback: Color-Coded Signals and Thresholds
To make the signals easier to interpret, the indicator offers visual feedback by coloring the price bars and the RSI plot according to the current market trend:
Green Bars indicate long signals when momentum is bullish.
Red Bars indicate short signals when momentum is bearish.
Gray Bars indicate neutral or undecided conditions when no clear signal is present.
In addition, the Long and Short Thresholds can be plotted directly on the chart to provide a clear reference for when signals are triggered, allowing traders to visually gauge the strength of the RSI relative to its thresholds.
Alerts for Automation
For traders who prefer automated notifications, the Savitzky Golay Median Filtered RSI includes built-in alert conditions for long and short signals. You can configure these alerts to notify you when a buy or sell condition is met, ensuring you never miss a trading opportunity.
Trading Applications
This indicator is versatile and can be used in a variety of trading strategies:
Trend Following: The combination of Savitzky-Golay and median filtering makes this RSI particularly useful for identifying strong trends without being misled by short-term noise. Traders can use the long and short signals to enter trades in the direction of the prevailing trend.
Reversal Trading: By adjusting the threshold levels, traders can use this indicator to spot potential reversals. When the RSI moves from overbought to oversold levels (or vice versa), it may signal a shift in market direction.
Swing Trading: The smoothed RSI provides a clear signal for short to medium-term price movements, making it an excellent tool for swing traders looking to capitalize on momentum shifts.
Risk Management: The filtered RSI can be used as part of a broader risk management strategy, helping traders avoid false signals and stay in trades only when the momentum is strong.
Final Thoughts
The Savitzky Golay Median Filtered RSI takes the classic RSI to the next level by applying advanced smoothing techniques that reduce noise and improve signal reliability. Whether you’re a trend follower, swing trader, or reversal trader, this indicator provides a more refined approach to momentum analysis, helping you make better-informed trading decisions.
As with all indicators, it is important to backtest thoroughly and incorporate sound risk management strategies when using the Savitzky Golay Median Filtered RSI in your trading system.
Thus following all of the key points here are some sample backtests on the 1D Chart
Disclaimer: Backtests are based off past results, and are not indicative of the future.
INDEX:BTCUSD
INDEX:ETHUSD
BINANCE:SOLUSD
Kalman For Loop [BackQuant]Kalman For Loop
Introducing BackQuant's Kalman For Loop (Kalman FL) — a highly adaptive trading indicator that uses a Kalman filter to smooth price data and generate actionable long and short signals. This advanced indicator is designed to help traders identify trends, filter out market noise, and optimize their entry and exit points with precision. Let’s explore how this indicator works, its key features, and how it can enhance your trading strategies.
Core Concept: Kalman Filter
The Kalman Filter is a mathematical algorithm used to estimate the state of a system by filtering noisy data. It is widely used in areas such as control systems, signal processing, and time-series analysis. In the context of trading, a Kalman filter can be applied to price data to smooth out short-term fluctuations, providing a clearer view of the underlying trend.
Unlike moving averages, which use fixed weights to smooth data, the Kalman Filter adjusts its estimate dynamically based on the relationship between the process noise and the measurement noise. This makes the filter more adaptive to changing market conditions, providing more accurate trend detection without the lag associated with traditional smoothing techniques.
Please see the original Kalman Price Filter
In this script, the Kalman For Loop applies the Kalman filter to the price source (default set to the closing price) to generate a smoothed price series, which is then used to calculate signals.
Adaptive Smoothing with Process and Measurement Noise
Two key parameters govern the behavior of the Kalman filter:
Process Noise: This controls the extent to which the model allows for uncertainty in price changes. A lower process noise value will make the filter smoother but slower to react to price changes, while a higher value makes it more sensitive to recent price fluctuations.
Measurement Noise: This represents the uncertainty or "noise" in the observed price data. A higher measurement noise value gives the filter more leeway to ignore short-term fluctuations, focusing on the broader trend. Lowering the measurement noise makes the filter more responsive to minor changes in price.
These settings allow traders to fine-tune the Kalman filter’s sensitivity, adjusting it to match their preferred trading style or market conditions.
For-Loop Scoring Mechanism
The Kalman FL further enhances the effectiveness of the Kalman filter by using a for-loop scoring system. This mechanism evaluates the smoothed price over a range of periods (defined by the Calculation Start and Calculation End inputs), assigning a score based on whether the current filtered price is higher or lower than previous values.
Long Signals: A long signal is generated when the for-loop score surpasses the Long Threshold (default set at 20), indicating a strong upward trend. This helps traders identify potential buying opportunities.
Short Signals: A short signal is triggered when the score crosses below the Short Threshold (default set at -10), signaling a potential downtrend or selling opportunity.
These signals are plotted on the chart, giving traders a clear visual indication of when to enter long or short positions.
Customization and Visualization Options
The Kalman For Loop comes with a range of customization options to give traders full control over how the indicator operates and is displayed on the chart:
Kalman Price Source: Choose the price data used for the Kalman filter (default is the closing price), allowing you to apply the filter to other price points like open, high, or low.
Filter Order: Set the order of the Kalman filter (default is 5), controlling how far back the filter looks in its calculations.
Process and Measurement Noise: Fine-tune the sensitivity of the Kalman filter by adjusting these noise parameters.
Signal Line Width and Colors: Customize the appearance of the signal line and the colors used to indicate long and short conditions.
Threshold Lines: Toggle the display of the long and short threshold lines on the chart for better visual clarity.
The indicator also includes the option to color the candlesticks based on the current trend direction, allowing traders to quickly identify changes in market sentiment. In addition, a background color feature further highlights the overall trend by shading the background in green for long signals and red for short signals.
Trading Applications
The Kalman For Loop is a versatile tool that can be adapted to a variety of trading strategies and markets. Some of the primary use cases include:
Trend Following: The adaptive nature of the Kalman filter helps traders identify the start of new trends with greater precision. The for-loop scoring system quantifies the strength of the trend, making it easier to stay in trades for longer when the trend remains strong.
Mean Reversion: For traders looking to capitalize on short-term reversals, the Kalman filter's ability to smooth price data makes it easier to spot when price has deviated too far from its expected path, potentially signaling a reversal.
Noise Reduction: The Kalman filter excels at filtering out short-term price noise, allowing traders to focus on the broader market movements without being distracted by minor fluctuations.
Risk Management: By providing clear long and short signals based on filtered price data, the Kalman FL helps traders manage risk by entering positions only when the trend is well-defined, reducing the chances of false signals.
Alerts and Automation
To further assist traders, the Kalman For Loop includes built-in alert conditions that notify you when a long or short signal is generated. These alerts can be configured to trigger notifications, helping you stay on top of market movements without constantly monitoring the chart.
Final Thoughts
The Kalman For Loop is a powerful and adaptive trading indicator that combines the precision of the Kalman filter with a for-loop scoring mechanism to generate reliable long and short signals. Whether you’re a trend follower or a reversal trader, this indicator offers the flexibility and accuracy needed to navigate complex markets with confidence.
As always, it’s important to backtest the indicator and adjust the settings to fit your trading style and market conditions. No indicator is perfect, and the Kalman FL should be used alongside other tools and sound risk management practices for the best results.
Adaptive Gaussian MA For Loop [BackQuant]Adaptive Gaussian MA For Loop
PLEASE Read the following carefully before applying this indicator to your trading system. Knowing the core logic behind the tools you're using allows you to integrate them into your strategy with confidence and precision.
Introducing BackQuant's Adaptive Gaussian Moving Average For Loop (AGMA FL) — a sophisticated trading indicator that merges the Gaussian Moving Average (GMA) with adaptive volatility to provide dynamic trend analysis. This unique indicator further enhances its effectiveness by utilizing a for-loop scoring mechanism to detect potential shifts in market direction. Let's dive into the components, the rationale behind them, and how this indicator can be practically applied to your trading strategies.
Understanding the Gaussian Moving Average (GMA)
The Gaussian Moving Average (GMA) is a smoothed moving average that applies Gaussian weighting to price data. Gaussian weighting gives more significance to data points near the center of the lookback window, making the GMA particularly effective at reducing noise while maintaining sensitivity to changes in price direction. In contrast to simpler moving averages like the SMA or EMA, GMA provides a more refined smoothing function, which can help traders follow the true trend in volatile markets.
In this script, the GMA is calculated over a defined Calculation Period (default 14), applying a Gaussian filter to smooth out market fluctuations and provide a clearer view of underlying trends.
Adaptive Volatility: A Dynamic Edge
The Adaptive feature in this indicator gives it the ability to adjust its sensitivity based on current market volatility. If the Adaptive option is enabled, the GMA uses a standard deviation-based volatility measure (with a default period of 20) to dynamically adjust the width of the Gaussian filter, allowing the GMA to react faster in volatile markets and more slowly in calm conditions. This dynamic nature ensures that the GMA stays relevant across different market environments.
When the Adaptive setting is disabled, the script defaults to a constant standard deviation value (default 1.0), providing a more stable but less responsive smoothing function.
Why Use Adaptive Gaussian Moving Average?
The Gaussian Moving Average already provides smoother results than standard moving averages, but by adding an adaptive component, the indicator becomes even more responsive to real-time price changes. In fast-moving or highly volatile markets, this adaptation allows traders to react quicker to emerging trends. Conversely, in quieter markets, it reduces over-sensitivity to minor fluctuations, thus lowering the risk of false signals.
For-Loop Scoring Mechanism
The heart of this indicator lies in its for-loop scoring system, which evaluates the smoothed price data (the GMA) over a specified range, comparing it to previous values. This scoring system assigns a numerical value based on whether the current GMA is higher or lower than previous values, creating a trend score.
Long Signals: These are generated when the for-loop score surpasses the Long Threshold (default set at 40), signaling that the GMA is gaining upward momentum, potentially identifying a favorable buying opportunity.
Short Signals: These are triggered when the score crosses below the Short Threshold (default set at -10), indicating that the market may be losing strength and that a selling or shorting opportunity could be emerging.
Thresholds & Customization Options
This indicator offers a high degree of flexibility, allowing you to fine-tune the settings according to your trading style and risk preferences:
Calculation Period: Adjust the lookback period for the Gaussian filter, affecting how smooth or responsive the indicator is to price changes.
Adaptive Mode: Toggle the adaptive feature on or off, allowing the GMA to dynamically adjust based on market volatility or remain consistent with a fixed standard deviation.
Volatility Settings: Control the standard deviation period for adaptive mode, fine-tuning how quickly the GMA responds to shifts in volatility.
For-Loop Settings: Modify the start and end points for the for-loop score calculation, adjusting the depth of analysis for trend signals.
Thresholds for Signals: Set custom long and short thresholds to determine when buy or sell signals should be generated.
Visualization Options: Choose to color bars based on trend direction, plot signal lines, or adjust the background color to reflect current market sentiment visually.
Trading Applications
The Adaptive Gaussian MA For Loop can be applied to a variety of trading styles and markets. Here are some key ways you can use this indicator in practice:
Trend Following: The combination of Gaussian smoothing and adaptive volatility helps traders stay on top of market trends, identifying significant momentum shifts while filtering out noise. The for-loop scoring system enhances this by providing a numerical representation of trend strength, making it easier to spot when a new trend is emerging or when an existing one is gaining strength.
Mean Reversion: For traders looking to capitalize on short-term market corrections, the adaptive nature of this indicator makes it easier to identify when price action is deviating too far from its smoothed trend, allowing for strategic entries and exits based on overbought or oversold conditions.
Swing Trading: With its ability to capture medium-term price movements while avoiding the noise of short-term fluctuations, this indicator is well-suited for swing traders who aim to profit from market reversals or short-to-mid-term trends.
Volatility Management: The adaptive feature allows the indicator to adjust dynamically in volatile markets, ensuring that it remains responsive in times of increased uncertainty while avoiding unnecessary noise in calmer periods. This makes it an effective tool for traders who want to manage risk by staying in tune with changing market conditions.
Final Thoughts
The Adaptive Gaussian MA For Loop is a powerful and flexible indicator that merges the elegance of Gaussian smoothing with the adaptability of volatility-based adjustments. By incorporating a for-loop scoring mechanism, this indicator provides traders with a comprehensive view of market trends and potential trade opportunities.
It’s important to test the settings on historical data and adapt them to your specific trading style, timeframe, and market conditions. As with any technical tool, the AGMA For Loop should be used in conjunction with other indicators and solid risk management practices for the best results.
Thus following all of the key points here are some sample backtests on the 1D Chart
Disclaimer: Backtests are based off past results, and are not indicative of the future.
INDEX:BTCUSD
INDEX:ETHUSD
BINANCE:SOLUSD
Two Pole Butterworth For Loop [BackQuant]Two Pole Butterworth For Loop
PLEASE read the following carefully, as understanding the underlying concepts and logic behind the indicator is key to incorporating it into your trading system in a sound and methodical manner.
Introducing BackQuant's Two Pole Butterworth For Loop (2P BW FL) — an advanced indicator that fuses the power of the Two Pole Butterworth filter with a dynamic for-loop scoring mechanism. This unique approach is designed to extract actionable trading signals by smoothing out price data and then analyzing it using a comparative scoring method. Let's delve into how this indicator works, why it was created, and how it can be used in various trading scenarios.
Understanding the Two Pole Butterworth Filter
The Butterworth filter is a signal processing tool known for its smooth response and minimal distortion. It's often used in electronic and communication systems to filter out unwanted noise. In trading, the Butterworth filter can be applied to price data to smooth out the volatility, providing traders with a clearer view of underlying trends without the whipsaws often associated with market noise.
The Two Pole Butterworth variant further enhances this effect by applying the filter with two poles, effectively creating a sharper transition between the passband and stopband. In simple terms, this allows the filter to follow the price action more closely, reacting to changes while maintaining smoothness.
In this script, the Two Pole Butterworth filter is applied to the Calculation Source (default is set to the closing price), creating a smoothed price series that serves as the foundation for further analysis.
Why Use a Two Pole Butterworth Filter?
The Two Pole Butterworth filter is chosen for its ability to reduce lag while maintaining a smooth output. This makes it an ideal choice for traders who want to capture trends without being misled by short-term volatility or market noise. By filtering the price data, the Two Pole Butterworth enables traders to focus on the broader market movements and avoid false signals.
The For-Loop Scoring Mechanism
In addition to the Butterworth filter, this script uses a for-loop scoring system to evaluate the smoothed price data. The for-loop compares the current value of the filtered price (referred to as "subject") to previous values over a defined range (set by the start and end input). The score is calculated based on whether the subject is higher or lower than the previous points, and the cumulative score is used to determine the strength of the trend.
Long and Short Signal Logic
Long Signals: A long signal is triggered when the score surpasses the Long Threshold (default set at 40). This suggests that the price has built sufficient upward momentum, indicating a potential buying opportunity.
Short Signals: A short signal is triggered when the score crosses under the Short Threshold (default set at -10). This indicates weakening price action or a potential downtrend, signaling a possible selling or shorting opportunity.
By utilizing this scoring system, the indicator identifies moments when the price momentum is shifting, helping traders enter positions at opportune times.
Customization and Visualization Options
One of the strengths of this indicator is its flexibility. Traders can customize various settings to fit their personal trading style or adapt it to different markets and timeframes:
Calculation Periods: Adjust the lookback period for the Butterworth filter, allowing for shorter or longer smoothing depending on the desired sensitivity.
Threshold Levels: Set the long and short thresholds to define when signals should be triggered, giving you control over the balance between sensitivity and specificity.
Signal Line Width and Colors: Customize the visual presentation of the indicator on the chart, including the width of the signal line and the colors used for long and short conditions.
Candlestick and Background Colors: If desired, the indicator can color the candlesticks or the background according to the detected trend, offering additional clarity at a glance.
Trading Applications
This Two Pole Butterworth For Loop indicator is versatile and can be adapted to various market conditions and trading strategies. Here are a few use cases where this indicator shines:
Trend Following: The Butterworth filter smooths the price data, making it easier to follow trends and identify when they are gaining or losing strength. The for-loop scoring system enhances this by providing a clear indication of how strong the current trend is compared to recent history.
Mean Reversion: For traders looking to identify potential reversals, the indicator’s ability to compare the filtered price to previous values over a range of periods allows it to spot moments when the trend may be losing steam, potentially signaling a reversal.
Swing Trading: The combination of smoothing and scoring allows swing traders to capture short to medium-term price movements by filtering out the noise and focusing on significant shifts in momentum.
Risk Management: By providing clear long and short signals, this indicator helps traders manage their risk by offering well-defined entry and exit points. The smooth nature of the Butterworth filter also reduces the risk of getting caught in false signals due to market noise.
Final Thoughts
The Two Pole Butterworth For Loop indicator offers traders a powerful combination of smoothing and scoring to detect meaningful trends and shifts in price momentum. Whether you are a trend follower, swing trader, or someone looking to refine your entry and exit points, this indicator provides the tools to make more informed trading decisions.
As always, it's essential to backtest the indicator on historical data and tailor the settings to your specific trading style and market. While the Butterworth filter helps reduce noise and smooth trends, no indicator can predict the future with absolute certainty, so it should be used in conjunction with other tools and sound risk management practices.
Thus following all of the key points here are some sample backtests on the 1D Chart
Disclaimer: Backtests are based off past results, and are not indicative of the future.
INDEX:BTCUSD
INDEX:ETHUSD
BINANCE:SOLUSD
Fourier For Loop [BackQuant]Fourier For Loop
PLEASE Read the following, as understanding an indicator's functionality is essential before integrating it into a trading strategy. Knowing the core logic behind each tool allows for a sound and strategic approach to trading.
Introducing BackQuant's Fourier For Loop (FFL) — a cutting-edge trading indicator that combines Fourier transforms with a for-loop scoring mechanism. This innovative approach leverages mathematical precision to extract trends and reversals in the market, helping traders make informed decisions. Let's break down the components, rationale, and potential use-cases of this indicator.
Understanding Fourier Transform in Trading
The Fourier Transform decomposes price movements into their frequency components, allowing for a detailed analysis of cyclical behavior in the market. By transforming the price data from the time domain into the frequency domain, this indicator identifies underlying patterns that traditional methods may overlook.
In this script, Fourier transforms are applied to the specified calculation source (defaulted to HLC3). The transformation yields magnitude values that can be used to score market movements over a defined range. This scoring process helps uncover long and short signals based on relative strength and trend direction.
Why Use Fourier Transforms?
Fourier Transforms excel in identifying recurring cycles and smoothing noisy data, making them ideal for fast-paced markets where price movements may be erratic. They also provide a unique perspective on market volatility, offering traders additional insights beyond standard indicators.
Calculation Logic: For-Loop Scoring Mechanism
The For Loop Scoring mechanism compares the magnitude of each transformed point in the series, summing the results to generate a score. This score forms the backbone of the signal generation system.
Long Signals: Generated when the score surpasses the defined long threshold (default set at 40). This indicates a strong bullish trend, signaling potential upward momentum.
Short Signals: Triggered when the score crosses under the short threshold (default set at -10). This suggests a bearish trend or potential downside risk.'
Thresholds & Customization
The indicator offers customizable settings to fit various trading styles:
Calculation Periods: Control how many periods the Fourier transform covers.
Long/Short Thresholds: Adjust the sensitivity of the signals to match different timeframes or risk preferences.
Visualization Options: Traders can visualize the thresholds, change the color of bars based on trend direction, and even color the background for enhanced clarity.
Trading Applications
This Fourier For Loop indicator is designed to be versatile across various market conditions and timeframes. Some of its key use-cases include:
Cycle Detection: Fourier transforms help identify recurring patterns or cycles, giving traders a head-start on market direction.
Trend Following: The for-loop scoring system helps confirm the strength of trends, allowing traders to enter positions with greater confidence.
Risk Management: With clearly defined long and short signals, traders can manage their positions effectively, minimizing exposure to false signals.
Final Note
Incorporating this indicator into your trading strategy adds a layer of mathematical precision to traditional technical analysis. Be sure to adjust the calculation start/end points and thresholds to match your specific trading style, and remember that no indicator guarantees success. Always backtest thoroughly and integrate the Fourier For Loop into a balanced trading system.
Thus following all of the key points here are some sample backtests on the 1D Chart
Disclaimer: Backtests are based off past results, and are not indicative of the future .
INDEX:BTCUSD
INDEX:ETHUSD
BINANCE:SOLUSD
Hourly Separator + Opening LineThis indicator shows the vertical and horizontal opening lines for the hourly timeframe.
Also has options to choose a different opening time:
- 1 Hour
- 30 Min
- 15 Min
- 10 Min
- 5 Min
Kalman PSaR [BackQuant]Kalman PSaR
Overview and Innovation
The Kalman PSaR combines the well-known Parabolic SAR (PSaR) with the advanced smoothing capabilities of the Kalman Filter . This innovative tool aims to enhance the traditional PSaR by integrating Kalman filtering, which reduces noise and improves trend detection. The Kalman PSaR adapts dynamically to price movements, making it a highly effective indicator for spotting trend shifts while minimizing the impact of false signals caused by market volatility.
Please Find the Basic Kalman Here:
Kalman Filter Dynamics
The Kalman Filter is a powerful algorithm for estimating the true value of a system amidst noisy data. In the Kalman PSaR, this filter is applied to the high, low, and closing prices, resulting in a smoother and more accurate representation of price action. The filter’s parameters—process noise and measurement noise—are customizable, allowing traders to fine-tune the sensitivity of the indicator to market conditions. By reducing the impact of noise, the Kalman-filtered PSaR offers clearer signals for identifying trend reversals and continuations.
Enhanced PSaR Calculation
The traditional Parabolic SAR is a popular trend-following indicator that highlights potential entry and exit points based on price acceleration. In the Kalman PSaR, this calculation is enhanced by the Kalman-filtered prices, providing a smoother and more reliable signal. The indicator continuously updates based on the acceleration factor and max step values, while the Kalman filter ensures that sudden price spikes or market noise do not trigger false signals.
Min Step and Max Step: These settings control the sensitivity of the PSaR. The Min Step sets the initial acceleration factor, while the Max Step limits how fast the PSaR adapts to price changes, helping traders fine-tune the indicator’s responsiveness.
Optional Smoothing Techniques To further enhance the signal clarity, the Kalman PSaR includes an optional smoothing feature. Traders can choose from various smoothing methods, such as SMA, Hull, EMA, WMA, TEMA, and more, to reduce short-term fluctuations and emphasize the underlying trend. The smoothing period is customizable, allowing traders to adjust the indicator’s behavior according to their preferred trading style and timeframe.
Color-Coded Candle Painting The Kalman PSaR features color-coded candles that change according to the trend direction. When the price is above the PSaR, candles are painted green to indicate a long trend, and when the price is below the PSaR, candles are painted red to signal a short trend. This visual representation makes it easy to interpret market sentiment at a glance, improving decision-making speed during fast-moving markets.
Key Features and Customization
Kalman Filter Customization: The process noise and measurement noise parameters allow traders to adjust how aggressively the filter adapts to price changes, making it suitable for both volatile and stable markets.
Smoothing Options: A variety of moving average types, such as SMA, Hull, EMA, and more, can be applied to smooth the PSaR values, ensuring that the signal remains clear even in choppy markets.
Dynamic Trend Detection: The Kalman PSaR dynamically updates based on price movements, helping traders spot trend reversals early while filtering out false signals caused by short-term volatility.
Bar Coloring and PSaR Plotting: Traders can choose to color candles based on trend direction or plot the PSaR directly on the chart for additional visual clarity.
Practical Applications
Trend-Following Strategies: The Kalman PSaR excels in trend-following strategies by providing timely signals of trend changes. The dynamic nature of the indicator allows traders to capture significant price movements while avoiding market noise.
Reversal Identification: The indicator’s ability to filter out noise and provide smoother signals makes it ideal for identifying reversals in volatile markets.
Risk Management: By plotting clear stop levels based on the PSaR, traders can use this indicator to effectively manage risk, placing stop-loss orders at key points based on the trend direction.
Conclusion
The Kalman PSaR is a fusion of the classic Parabolic SAR and the Kalman filter, offering enhanced trend detection with reduced noise. Its customizable filtering and smoothing options, combined with dynamic trend-following capabilities, make it a versatile tool for traders seeking to improve their timing and signal accuracy. The adaptive nature of the Kalman filter, combined with the robust PSaR logic, helps traders stay on the right side of the market and manage risk more effectively.
Revenue GridDescription:
The Revenue Grid indicator helps traders and investors visualize a stock’s valuation by plotting horizontal lines based on its price-to-sales (P/S) ratio. This tool displays how the stock price compares to multiples of its total revenue per share, giving a clear perspective on valuation benchmarks.
Fundamental Concept:
The price-to-sales ratio compares a company’s stock price to its revenue per share. It’s used to evaluate whether a stock is overvalued or undervalued based on its revenue.
This indicator offers a unique way to view this ratio by applying Fibonacci multiples to the revenue per share. It plots lines at these multiples to show how the stock price measures up against different valuation levels.
How It Works:
Data Inputs:
Total Revenue (TR): The company’s revenue over the past twelve months.
Total Shares Outstanding (TSO): The total number of shares in circulation.
Calculation:
Calculates the revenue per share (TR/TSO).
Plots lines at fixed Fibonacci multiples (e.g., 1x, 2x, 3x, 5x, 8x, 13x) of the revenue per share value.
How to Use:
1. Add the "Revenue Grid" indicator to your chart by searching for it in the indicator library and applying it.
2. Observe the lines plotted on the chart. If these lines are trending upwards, it indicates that the revenue is increasing.
3. Analyze how historical prices trend relative to these lines. Look for periods where the stock price supports around specific multiples, you can easily get a sense of overvaluation or undervaluation in certain periods.
Use this information to guide further analysis and investment decisions.
Benefits:
1. Clear Valuation View: Easily see how the company’s revenue translates into stock price levels.
2. Investment Insight: Identify if the stock price is lagging behind revenue growth, which might signal a buying opportunity.
3. Historical Context: Understand how the market has historically valued the company and assess the current valuation.
Do let me know your feedbacks in comments. Happy Investing :)
DEMA Adaptive DMI [BackQuant]DEMA Adaptive DMI
PLEASE Read the following, knowing what an indicator does at its core before adding it into a system is pivotal. The core concepts can allow you to include it in a logical and sound manner.
Conceptual Foundation and Innovation
The DEMA Adaptive DMI blends the Double Exponential Moving Average (DEMA) with the Directional Movement Index (DMI) to offer a unique approach to trend-following. By applying DEMA to the high and low prices, this indicator refines the traditional DMI calculation, enhancing its responsiveness to price changes. This results in a more adaptive and timely measure of market trends and momentum, providing traders with a more refined tool for capturing directional movements in the market.
Technical Composition and Calculation
At its core, the DEMA Adaptive DMI calculates the DEMA for both the high and low prices over a user-defined period. This dual application of DEMA serves to smooth out price fluctuations while retaining sensitivity to market movements. The DMI is then derived from the changes in these DEMA values, producing a set of plus and minus directional indicators that reflect the prevailing trend. Additionally, an Average Directional Index (ADX) is computed to measure the strength of the trend, with the entire process being dynamically adjusted based on the DEMA calculations.
DEMA Application:
The DEMA is applied to both high and low prices to reduce lag and provide a smoother representation of price action.
Directional Movement Calculation: The DMI is calculated using the smoothed price changes, resulting in plus and minus indicators that accurately reflect market trends.
ADX Calculation:
The ADX is computed to quantify the strength of the trend, offering traders insight into whether the market is trending strongly or is in a phase of consolidation.
Features and User Inputs The DEMA Adaptive DMI offers a range of customizable options to suit different trading styles and market conditions:
DEMA Calculation Period: Users can set the period for the DEMA calculation, allowing for adjustments based on the desired sensitivity.
DMI Length: The length of the DMI calculation can be adjusted, providing flexibility in how trends are measured.
ADX Smoothing Period: The smoothing period for the ADX can be customized to fine-tune the trend strength measurement.
Divergence Detection: Optional divergence detection features allow traders to spot potential reversals based on the DMI and price action.
Visualization options include static high and low levels to mark extreme DMI thresholds, the ability to color bars according to trend direction, and background hues to highlight overbought and oversold conditions.
Practical Applications
The DEMA Adaptive DMI is particularly effective in markets where trend strength and direction are crucial for successful trading. Traders can leverage this indicator to:
Identify Trend Reversals:
Detect potential trend reversals by monitoring the DMI and ADX in conjunction with divergence signals.
Trend Confirmation:
Use the DEMA-based DMI to confirm the strength and direction of a trend, aiding in the timing of entries and exits.
Strategic Positioning:
The indicator's responsiveness allows traders to position themselves effectively in fast-moving markets, reducing the risk of late entries or exits.
Advantages and Strategic Value
By integrating the DEMA with the DMI, this indicator provides a more adaptive and timely measure of market trends. The reduced lag from the DEMA ensures that traders receive signals that are closely aligned with current market conditions, while the dynamic DMI calculation offers a more accurate representation of trend direction and strength. This makes the DEMA Adaptive DMI a valuable tool for traders looking to enhance their trend-following strategies with a focus on precision and adaptability.
Summary and Usage Tips
The DEMA Adaptive DMI is a sophisticated trend-following indicator that combines the benefits of DEMA and DMI into a single, powerful tool. Traders are encouraged to incorporate this indicator into their trading systems for a more nuanced and responsive approach to trend detection and confirmation. Whether used for identifying trend reversals, confirming trend strength, or strategically positioning in the market, the DEMA Adaptive DMI offers a versatile and reliable solution for trend-following strategies.
Thus following all of the key points here are some sample backtests on the 1D Chart
Disclaimer: Backtests are based off past results, and are not indicative of the future.
INDEX:BTCUSD
INDEX:ETHUSD
BINANCE:SOLUSD
Opening Price LinesThis script allows the user to set 16 custom opening time price lines and labels, as well as 4 vertical lines to delineate times of the day.
Opening price is crucial for PO3 and OHLC/OLHC market strategies. If you are bearish, you want to get in above the opening price of a candle; conversely if you are bullish you want to enter below the opening price of a candle.
This indicator will aid in identifying time clusters in price as well as identifying important times for whatever strategy the user employs.
*Many thanks to TFO for the framework from which this indicator was created.*
Multi-Timeframe EMA Distance & % Change TableDescription of Multi-Timeframe EMA Distance & % Change Table
The Multi-Timeframe EMA Distance & % Change Table indicator is designed to display the distance and percentage change between the current price and the Exponential Moving Averages (EMAs) on multiple timeframes. It creates a table to show these values, with customizable options for decimal precision .
Key Features:
Inputs:
- Timeframes (tf1, tf2, tf3, tf4): User-defined timeframes for EMA calculations (e.g., 1 minute, 15 minutes, daily, etc.).
- EMA Levels (emaLevel, emaLevel2, emaLevel3): User-defined periods for three different EMAs.
EMA Calculations:
- Computes EMAs for the specified levels (50, 100, 200) on each of the user-selected timeframes.
Plotting:
- Plots the EMAs on the chart with distinct colors: Orange, Teal, and Green for different EMAs.
Display Options:
- Checkbox (displayAsPercentage): Allows the user to toggle between displaying distances or percentage changes.
- Decimal Precision:
- decimalPlacesDistance: Specifies the number of decimal places for rounded distance values.
- decimalPlacesPercentage: Specifies the number of decimal places for rounded percentage values.
Table Creation:
- Location: Table is placed in the top-right corner of the chart.
- Headers: Includes columns for each timeframe and EMA distance/percentage.
Distance and Percentage Calculations:
- Distances: Calculated as the difference between the current price and the EMA values for each timeframe.
- Percentages: Calculated as the distance divided by the EMA value, converted to a percentage.
Decimal Rounding:
- Custom Rounding Function: Ensures that distance and percentage values are displayed with the user-specified number of decimal places.
Color Coding:
- Distance Values: Colored green if positive, red if negative.
- Table Entries: Display either the rounded distance or percentage, based on user selection.
Table Update:
- The table is dynamically updated with either distance or percentage values based on the user's choice and rounded to the specified number of decimal places.
This indicator provides a comprehensive overview of EMA distances and percentage changes across multiple timeframes, with detailed control over the precision of the displayed values.
MarketcapDefinition
This indicator was designed to reveal the relationship between the price of the product and its market value. The red average marketcap line that appears on the chart is the line. And the further up this line moves from the chart, the more it shows that there is a mismatch between the price and the market value. So what does this incompatibility mean? There are purchases of the product, but since the supply of the product into circulation is constantly increasing, it means that these purchases are not reflected in the price, which means there is inflation.
The main purpose of our indicator is to calculate inflation of the product. It is the understanding of whether or not the amount of supply put into circulation in response to the investment is reflected in the product price while increasing the market value.
Attention: Transactions are made based on the data received via CRYPTOCAP. In cases where this data cannot be received, the "UNSUPPORTED SOURCE" warning is displayed. You can use Settings to change the source from which data can be retrieved.
Labels
The labels are explained one by one below.
MARKETCAP: Shows the current market value.
ATH MARKETCAP: Shows the highest market value of all time.
MARKETCAP RATIO: It gives the ratio between the highest level and the lowest level of the market value.
PRICE RATIO: Gives the ratio between the highest level and the lowest level of the crypto price.
ALL INFLATION PERCENT: It refers to the percentage of all inflation that has developed so far. It is also the percentage difference between market value and price.
MONTHLY INFLATION PERCENT: It refers to the monthly estimated inflation percentage.
CIRCULATING SUPPLY: It refers to the estimated circulation supply of the product.
Best Use
It should bring to mind the idea that the further the indicator curve moves away from the price, the higher the inflation will be. In order for a product to reach its previous peak, its market value must normally increase by the "MARKETCAP RATIO" value and the "PRICE RATIO" value. This should make you think that this product needs more investment to reach its former peak. And it is necessary to be careful when purchasing such products.
Disclaimer
This indicator is for informational purposes only and should be used for educational purposes only. You may lose money if you rely on this to trade without additional information. Use at your own risk.
Version
v1.0
Volume Spread Analysis [TANHEF]Volume Spread Analysis: Understanding Market Intentions through the Interpretation of Volume and Price Movements.
█ Simple Explanation:
The Volume Spread Analysis (VSA) indicator is a comprehensive tool that helps traders identify key market patterns and trends based on volume and spread data. This indicator highlights significant VSA patterns and provides insights into market behavior through color-coded volume/spread bars and identification of bars indicating strength, weakness, and neutrality between buyers and sellers. It also includes powerful volume and spread forecasting capabilities.
█ Laws of Volume Spread Analysis (VSA):
The origin of VSA begins with Richard Wyckoff, a pivotal figure in its development. Wyckoff made significant contributions to trading theory, including the formulation of three basic laws:
The Law of Supply and Demand: This fundamental law states that supply and demand balance each other over time. High demand and low supply lead to rising prices until demand falls to a level where supply can meet it. Conversely, low demand and high supply cause prices to fall until demand increases enough to absorb the excess supply.
The Law of Cause and Effect: This law assumes that a 'cause' will result in an 'effect' proportional to the 'cause'. A strong 'cause' will lead to a strong trend (effect), while a weak 'cause' will lead to a weak trend.
The Law of Effort vs. Result: This law asserts that the result should reflect the effort exerted. In trading terms, a large volume should result in a significant price move (spread). If the spread is small, the volume should also be small. Any deviation from this pattern is considered an anomaly.
█ Volume and Spread Analysis Bars:
Display: Volume and/or spread bars that consist of color coded levels. If both of these are displayed, the number of spread bars can be limited for visual appeal and understanding, with the spread bars scaled to match the volume bars. While automatic calculation of the number of visual bars for auto scaling is possible, it is avoided to prevent the indicator from reloading whenever the number of visual price bars on the chart is adjusted, ensuring uninterrupted analysis. A displayable table (Legend) of bar colors and levels can give context and clarify to each volume/spread bar.
Calculation: Levels are calculated using multipliers applied to moving averages to represent key levels based on historical data: low, normal, high, ultra. This method smooths out short-term fluctuations and focuses on longer-term trends.
Low Level: Indicates reduced volatility and market interest.
Normal Level: Reflects typical market activity and volatility.
High Level: Indicates increased activity and volatility.
Ultra Level: Identifies extreme levels of activity and volatility.
This illustrates the appearance of Volume and Spread bars when scaled and plotted together:
█ Forecasting Capabilities:
Display: Forecasted volume and spread levels using predictive models.
Calculation: Volume and Spread prediction calculations differ as volume is linear and spread is non-linear.
Volume Forecast (Linear Forecasting): Predicts future volume based on current volume rate and bar time till close.
Spread Forecast (Non-Linear Dynamic Forecasting): Predicts future spread using a dynamic multiplier, less near midpoint (consolidation) and more near low or high (trending), reflecting non-linear expansion.
Moving Averages: In forecasting, moving averages utilize forecasted levels instead of actual levels to ensure the correct level is forecasted (low, normal, high, or ultra).
The following compares forecasted volume with actual resulting volume, highlighting the power of early identifying increased volume through forecasted levels:
█ VSA Patterns:
Criteria and descriptions for each VSA pattern are available as tooltips beside them within the indicator’s settings. These tooltips provide explanations of potential developments based on the volume and spread data.
Signs of Strength (🟢): Patterns indicating strong buying pressure and potential market upturns.
Down Thrust
Selling Climax
No Effort → Bearish Result
Bearish Effort → No Result
Inverse Down Thrust
Failed Selling Climax
Bull Outside Reversal
End of Falling Market (Bag Holder)
Pseudo Down Thrust
No Supply
Signs of Weakness (🔴): Patterns indicating strong selling pressure and potential market downturns.
Up Thrust
Buying Climax
No Effort → Bullish Result
Bullish Effort → No Result
Inverse Up Thrust
Failed Buying Climax
Bear Outside Reversal
End of Rising Market (Bag Seller)
Pseudo Up Thrust
No Demand
Neutral Patterns (🔵): Patterns indicating market indecision and potential for continuation or reversal.
Quiet Doji
Balanced Doji
Strong Doji
Quiet Spinning Top
Balanced Spinning Top
Strong Spinning Top
Quiet High Wave
Balanced High Wave
Strong High Wave
Consolidation
Bar Patterns (🟡): Common candlestick patterns that offer insights into market sentiment. These are required in some VSA patterns and can also be displayed independently.
Bull Pin Bar
Bear Pin Bar
Doji
Spinning Top
High Wave
Consolidation
This demonstrates the acronym and descriptive options for displaying bar patterns, with the ability to hover over text to reveal the descriptive text along with what type of pattern:
█ Alerts:
VSA Pattern Alerts: Notifications for identified VSA patterns at bar close.
Volume and Spread Alerts: Alerts for confirmed and forecasted volume/spread levels (Low, High, Ultra).
Forecasted Volume and Spread Alerts: Alerts for forecasted volume/spread levels (High, Ultra) include a minimum percent time elapsed input to reduce false early signals by ensuring sufficient bar time has passed.
█ Inputs and Settings:
Display Volume and/or Spread: Choose between displaying volume bars, spread bars, or both with different lookback periods.
Indicator Bar Color: Select color schemes for bars (Normal, Detail, Levels).
Indicator Moving Average Color: Select schemes for bars (Fill, Lines, None).
Price Bar Colors: Options to color price bars based on VSA patterns and volume levels.
Legend: Display a table of bar colors and levels for context and clarity of volume/spread bars.
Forecast: Configure forecast display and prediction details for volume and spread.
Average Multipliers: Define multipliers for different levels (Low, High, Ultra) to refine the analysis.
Moving Average: Set volume and spread moving average settings.
VSA: Select the VSA patterns to be calculated and displayed (Strength, Weakness, Neutral).
Bar Patterns: Criteria for bar patterns used in VSA (Doji, Bull Pin Bar, Bear Pin Bar, Spinning Top, Consolidation, High Wave).
Colors: Set exact colors used for indicator bars, indicator moving averages, and price bars.
More Display Options: Specify how VSA pattern text is displayed (Acronym, Descriptive), positioning, and sizes.
Alerts: Configure alerts for VSA patterns, volume, and spread levels, including forecasted levels.
█ Usage:
The Volume Spread Analysis indicator is a helpful tool for leveraging volume spread analysis to make informed trading decisions. It offers comprehensive visual and textual cues on the chart, making it easier to identify market conditions, potential reversals, and continuations. Whether analyzing historical data or forecasting future trends, this indicator provides insights into the underlying factors driving market movements.
VolumeSpreadAnalysisLibrary "VolumeSpreadAnalysis"
A library for Volume Spread Analysis (VSA).
spread(_barIndex)
Calculates the spread of a bar.
Parameters:
_barIndex (int) : (int) The index of the bar.
Returns: (float) The spread of the bar.
volume(_barIndex)
Retrieves the volume of a bar.
Parameters:
_barIndex (int) : (int) The index of the bar.
Returns: (float) The volume of the bar.
body(_barIndex)
Calculates the body of a bar.
Parameters:
_barIndex (simple int) : (int) The index of the bar.
Returns: (float) The body size of the bar.
wickUpper(_barIndex)
Calculates the upper wick of a bar (upper shadow).
Parameters:
_barIndex (simple int) : (int) The index of the bar.
Returns: (float) The upper wick size of the bar.
wickLower(_barIndex)
Calculates the lower wick of a bar (lower shadow).
Parameters:
_barIndex (simple int) : (int) The index of the bar.
Returns: (float) The lower wick size of the bar.
calcForecastedSMA(_source, _length, _forecastedLevel)
Calculates the forecasted Simple Moving Average (SMA).
Parameters:
_source (float) : (series float) Source data for calculation.
_length (simple int) : (int) The length of the SMA.
_forecastedLevel (float) : (float) The forecasted level to include in the calculation.
Returns: (float) The forecasted SMA value.
calcForecastedEMA(_source, _length, _forecastedLevel)
Calculates the forecasted Exponential Moving Average (EMA).
Parameters:
_source (float) : (series float) Source data for calculation.
_length (simple int) : (int) The length of the EMA.
_forecastedLevel (float) : (float) The forecasted level to include in the calculation.
Returns: (float) The forecasted EMA value.
calcForecastedRMA(_source, _length, _forecastedLevel)
Calculates the forecasted Relative Moving Average (RMA).
Parameters:
_source (float) : (series float) Source data for calculation.
_length (simple int) : (int) The length of the RMA.
_forecastedLevel (float) : (float) The forecasted level to include in the calculation.
Returns: (float) The forecasted RMA value.
calcForecastedWMA(_source, _length, _forecastedLevel)
Calculates the forecasted Weighted Moving Average (WMA).
Parameters:
_source (float) : (series float) Source data for calculation.
_length (simple int) : (int) The length of the WMA.
_forecastedLevel (float) : (float) The forecasted level to include in the calculation.
Returns: (float) The forecasted WMA value.
calcElapsedTimePercent()
Calculates the elapsed time percent of the current bar.
Returns: (float) The elapsed time percent.
calcForecastedSpread(multiplierAtMidpoints, multiplierAtPeaks)
Calculates the forecasted spread using elapsed time and dynamic multipliers, handling spread's non-linear nature.
Parameters:
multiplierAtMidpoints (float) : (float) The multiplier value at midpoints.
multiplierAtPeaks (float) : (float) The multiplier value at peaks.
Returns: (float) The forecasted spread value.
calcForecastedVolume()
Calculates the forecasted volume using elapsed time, satisfying volume's linear nature.
Returns: (float) The forecasted volume value.
calcForecastedMA(_source, _length, _forecastedSource, _type)
Calculates the forecasted Moving Average (MA) based on the specified type.
Parameters:
_source (float) : (series float) Source data for calculation.
_length (simple int) : (int) The length of the MA.
_forecastedSource (float) : (float) The forecasted level to include in the calculation.
_type (simple string) : (string) The type of the MA ("SMA", "EMA", "SMMA (RMA)", "WMA").
Returns: (float) The forecasted MA value.
calcMA(_source, _length, _type)
Calculates the Moving Average (MA) based on the specified type.
Parameters:
_source (float) : (series float) Source data for calculation.
_length (simple int) : (int) The length of the MA.
_type (simple string) : (string) The type of the MA ("SMA", "EMA", "SMMA (RMA)", "WMA").
Returns: (float) The MA value.
bullBar(_barIndex)
Determines if the bar is bullish.
Parameters:
_barIndex (simple int) : (int) The index of the bar.
Returns: (bool) True if the bar is bullish, otherwise false.
bearBar(_barIndex)
Determines if the bar is bearish.
Parameters:
_barIndex (simple int) : (int) The index of the bar.
Returns: (bool) True if the bar is bearish, otherwise false.
breakout(_barIndex)
Determines if there is a breakout above the previous bar.
Parameters:
_barIndex (simple int) : (int) The index of the bar.
Returns: (bool) True if there is a breakout, otherwise false.
breakdown(_barIndex)
Determines if there is a breakdown below the previous bar.
Parameters:
_barIndex (simple int) : (int) The index of the bar.
Returns: (bool) True if there is a breakdown, otherwise false.
rejectionWickUpper(_rejectionWick)
Determines if the upper wick is a rejection wick.
Parameters:
_rejectionWick (simple float) : (float) The rejection wick percentage.
Returns: (bool) True if the upper wick is a rejection wick, otherwise false.
rejectionWickLower(_rejectionWick)
Determines if the lower wick is a rejection wick.
Parameters:
_rejectionWick (simple float) : (float) The rejection wick percentage.
Returns: (bool) True if the lower wick is a rejection wick, otherwise false.
setupDataVolume(_data, _mult_Low, _mult_High, _mult_Ultra, _maLengthVolume, _maTypeVolume)
Sets up data for volume levels.
Parameters:
_data (map) : (map) The map to store the levels.
_mult_Low (simple float) : (float) The multiplier for low level.
_mult_High (simple float) : (float) The multiplier for high level.
_mult_Ultra (simple float) : (float) The multiplier for ultra level.
_maLengthVolume (simple int) : (int) The length for MA.
_maTypeVolume (simple string) : (string) The type for MA.
Returns: (void) Nothing.
setupDataSpread(_data, _mult_Low, _mult_High, _mult_Ultra, _maLengthSpread, _maTypeSpread)
Sets up data for spread levels.
Parameters:
_data (map) : (map) The map to store the levels.
_mult_Low (simple float) : (float) The multiplier for low level.
_mult_High (simple float) : (float) The multiplier for high level.
_mult_Ultra (simple float) : (float) The multiplier for ultra level.
_maLengthSpread (simple int) : (int) The length for MA.
_maTypeSpread (simple string) : (string) The type for MA.
Returns: (void) Nothing.
setupDataForecastVolume(_dataForecast, _mult_Low, _mult_High, _mult_Ultra, _maLengthVolume, _predictedLevelVolume, _maTypeVolume)
Sets up data for volume and spread levels for forecast.
Parameters:
_dataForecast (map)
_mult_Low (simple float) : (float) The multiplier for low level.
_mult_High (simple float) : (float) The multiplier for high level.
_mult_Ultra (simple float) : (float) The multiplier for ultra level.
_maLengthVolume (simple int) : (int) The length for MA.
_predictedLevelVolume (float) : (float) The predicted level for MA.
_maTypeVolume (simple string) : (string) The type for MA.
Returns: (void) Nothing.
setupDataForecastSpread(_dataForecast, _mult_Low, _mult_High, _mult_Ultra, _maLengthSpread, _predictedLevelSpread, _maTypeSpread)
Sets up data for spread levels for forecast.
Parameters:
_dataForecast (map)
_mult_Low (simple float) : (float) The multiplier for low level.
_mult_High (simple float) : (float) The multiplier for high level.
_mult_Ultra (simple float) : (float) The multiplier for ultra level.
_maLengthSpread (simple int) : (int) The length for MA.
_predictedLevelSpread (float) : (float) The predicted level for MA.
_maTypeSpread (simple string) : (string) The type for MA.
Returns: (void) Nothing.
isVolumeLow(_data, _barIndex)
Determines if the volume is low.
Parameters:
_data (map) : (map) The data map with volume levels.
_barIndex (int)
Returns: (bool) True if the volume is low, otherwise false.
isVolumeNormal(_data, _barIndex)
Determines if the volume is normal.
Parameters:
_data (map) : (map) The data map with volume levels.
_barIndex (int)
Returns: (bool) True if the volume is normal, otherwise false.
isVolumeHigh(_data, _barIndex)
Determines if the volume is high.
Parameters:
_data (map) : (map) The data map with volume levels.
_barIndex (int)
Returns: (bool) True if the volume is high, otherwise false.
isVolumeUltra(_data, _barIndex)
Determines if the volume is ultra.
Parameters:
_data (map) : (map) The data map with volume levels.
_barIndex (int)
Returns: (bool) True if the volume is ultra, otherwise false.
isSpreadLow(_data, _barIndex)
Determines if the spread is low.
Parameters:
_data (map) : (map) The data map with spread levels.
_barIndex (int)
Returns: (bool) True if the spread is low, otherwise false.
isSpreadNormal(_data, _barIndex)
Determines if the spread is normal.
Parameters:
_data (map) : (map) The data map with spread levels.
_barIndex (int)
Returns: (bool) True if the spread is normal, otherwise false.
isSpreadHigh(_data, _barIndex)
Determines if the spread is high.
Parameters:
_data (map) : (map) The data map with spread levels.
_barIndex (int)
Returns: (bool) True if the spread is high, otherwise false.
isSpreadUltra(_data, _barIndex)
Determines if the spread is ultra.
Parameters:
_data (map) : (map) The data map with spread levels.
_barIndex (int)
Returns: (bool) True if the spread is ultra, otherwise false.
isVolumeText(_data)
Determines text string representing the volume area level.
Parameters:
_data (map) : (map) The data map with volume levels.
Returns: (string) Text string of Low, Normal, High, or Ultra.
isSpreadText(_data)
Determines text string representing the spread area level.
Parameters:
_data (map) : (map) The data map with spread levels.
Returns: (string) Text string of Low, Normal, High, or Ultra.
calcBarColor(_value, _level)
Calculates the color based level.
Parameters:
_value (float) : (float) The value to check.
_level (float) : (float) The value level for comparison.
Returns: (color) The color for the bar.
bullPinBar(_maxBodyPercent, _minWickPercent)
Determines if the bar is a bull pin bar.
Parameters:
_maxBodyPercent (simple float) : (float) The maximum body percentage.
_minWickPercent (simple float) : (float) The minimum wick percentage.
Returns: (bool) True if the bar is a bull pin bar, otherwise false.
bearPinBar(_maxBodyPercent, _minWickPercent)
Determines if the bar is a bear pin bar.
Parameters:
_maxBodyPercent (simple float) : (float) The maximum body percentage.
_minWickPercent (simple float) : (float) The minimum wick percentage.
Returns: (bool) True if the bar is a bear pin bar, otherwise false.
dojiBar(_maxBodyPercent)
Determines if the bar is a doji.
Parameters:
_maxBodyPercent (simple float) : (float) The maximum body percentage.
Returns: (bool) True if the bar is a doji, otherwise false.
spinningTopBar(_minWicksPercent, _emaLength)
Determines if the bar is a spinning top.
Parameters:
_minWicksPercent (simple float) : (float) The minimum wicks percentage.
_emaLength (simple int) : (int) The length for EMA calculation.
Returns: (bool) True if the bar is a spinning top, otherwise false.
highWaveBar(_minBodyPercent, _minWickPercent, _bars)
Determines if the bar is a high wave bar.
Parameters:
_minBodyPercent (simple float) : (float) The minimum body percentage.
_minWickPercent (simple float) : (float) The minimum wick percentage.
_bars (simple int) : (int) The number of bars for comparison.
Returns: (bool) True if the bar is a high wave bar, otherwise false.
consolidationBar(_data, _spread, _bars)
Determines if the bars are in consolidation.
Parameters:
_data (map) : (map) The data map with spread levels.
_spread (simple float) : (float) The spread percentage for comparison.
_bars (simple int) : (int) The number of bars for comparison.
Returns: (bool) True if the bars are in consolidation, otherwise false.
S_DownThrust(_data, _bullPinBarMaxBody, _bullPinBarMinWick)
Determines if there is a sign of strength (DownThrust).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_bullPinBarMaxBody (simple float) : (float) The maximum body percentage for bull pin bar.
_bullPinBarMinWick (simple float) : (float) The minimum wick percentage for bull pin bar.
Returns: (bool) True if there is a sign of strength (DownThrust), otherwise false.
S_SellingClimax(_data, _rejectionWick)
Determines if there is a sign of strength (Selling Climax).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_rejectionWick (simple float) : (float) The rejection wick percentage.
Returns: (bool) True if there is a sign of strength (Selling Climax), otherwise false.
S_NoEffortBearishResult()
Determines if there is a sign of strength (No Effort Bearish Result).
Returns: (bool) True if there is a sign of strength (No Effort Bearish Result), otherwise false.
S_BearishEffortNoResult()
Determines if there is a sign of strength (Bearish Effort No Result).
Returns: (bool) True if there is a sign of strength (Bearish Effort No Result), otherwise false.
S_InverseDownThrust(_data, _bearPinBarMaxBody, _bearPinBarMinWick)
Determines if there is a sign of strength (Inverse DownThrust).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_bearPinBarMaxBody (simple float) : (float) The maximum body percentage for bear pin bar.
_bearPinBarMinWick (simple float) : (float) The minimum wick percentage for bear pin bar.
Returns: (bool) True if there is a sign of strength (Inverse DownThrust), otherwise false.
S_FailedSellingClimax()
Determines if there is a sign of strength (Failed Selling Climax).
Returns: (bool) True if there is a sign of strength (Failed Selling Climax), otherwise false.
S_BullOutsideReversal(_data)
Determines if there is a sign of strength (Bull Outside Reversal).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
Returns: (bool) True if there is a sign of strength (Bull Outside Reversal), otherwise false.
S_EndOfFallingMarket(_data)
Determines if there is a sign of strength (End of Falling Market).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
Returns: (bool) True if there is a sign of strength (End of Falling Market), otherwise false.
S_PseudoDownThrust(_bullPinBarMaxBody, _bullPinBarMinWick)
Determines if there is a sign of strength (Pseudo DownThrust).
Parameters:
_bullPinBarMaxBody (simple float) : (float) The maximum body percentage for bull pin bar.
_bullPinBarMinWick (simple float) : (float) The minimum wick percentage for bull pin bar.
Returns: (bool) True if there is a sign of strength (Pseudo DownThrust), otherwise false.
S_NoSupply(_bullPinBarMaxBody, _bullPinBarMinWick)
Determines if there is a sign of strength (No Supply).
Parameters:
_bullPinBarMaxBody (simple float) : (float) The maximum body percentage for bull pin bar.
_bullPinBarMinWick (simple float) : (float) The minimum wick percentage for bull pin bar.
Returns: (bool) True if there is a sign of strength (No Supply), otherwise false.
W_UpThrust(_data, _bearPinBarMaxBody, _bearPinBarMinWick)
Determines if there is a sign of weakness (UpThrust).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_bearPinBarMaxBody (simple float) : (float) The maximum body percentage for bear pin bar.
_bearPinBarMinWick (simple float) : (float) The minimum wick percentage for bear pin bar.
Returns: (bool) True if there is a sign of weakness (UpThrust), otherwise false.
W_BuyingClimax(_data, _rejectionWick)
Determines if there is a sign of weakness (Buying Climax).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_rejectionWick (simple float) : (float) The rejection wick percentage.
Returns: (bool) True if there is a sign of weakness (Buying Climax), otherwise false.
W_NoEffortBullishResult()
Determines if there is a sign of weakness (No Effort Bullish Result).
Returns: (bool) True if there is a sign of weakness (No Effort Bullish Result), otherwise false.
W_BullishEffortNoResult()
Determines if there is a sign of weakness (Bullish Effort No Result).
Returns: (bool) True if there is a sign of weakness (Bullish Effort No Result), otherwise false.
W_InverseUpThrust(_data, _bullPinBarMaxBody, _bullPinBarMinWick)
Determines if there is a sign of weakness (Inverse UpThrust).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_bullPinBarMaxBody (simple float) : (float) The maximum body percentage for bull pin bar.
_bullPinBarMinWick (simple float) : (float) The minimum wick percentage for bull pin bar.
Returns: (bool) True if there is a sign of weakness (Inverse UpThrust), otherwise false.
W_FailedBuyingClimax()
Determines if there is a sign of weakness (Failed Buying Climax).
Returns: (bool) True if there is a sign of weakness (Failed Buying Climax), otherwise false.
W_BearOutsideReversal(_data)
Determines if there is a sign of weakness (Bear Outside Reversal).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
Returns: (bool) True if there is a sign of weakness (Bear Outside Reversal), otherwise false.
W_EndOfRisingMarket(_data)
Determines if there is a sign of weakness (End of Rising Market).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
Returns: (bool) True if there is a sign of weakness (End of Rising Market), otherwise false.
W_PseudoUpThrust(_bearPinBarMaxBody, _bearPinBarMinWick)
Determines if there is a sign of weakness (Pseudo UpThrust).
Parameters:
_bearPinBarMaxBody (simple float) : (float) The maximum body percentage for bear pin bar.
_bearPinBarMinWick (simple float) : (float) The minimum wick percentage for bear pin bar.
Returns: (bool) True if there is a sign of weakness (Pseudo UpThrust), otherwise false.
W_NoDemand(_bearPinBarMaxBody, _bearPinBarMinWick)
Determines if there is a sign of weakness (No Demand).
Parameters:
_bearPinBarMaxBody (simple float) : (float) The maximum body percentage for bear pin bar.
_bearPinBarMinWick (simple float) : (float) The minimum wick percentage for bear pin bar.
Returns: (bool) True if there is a sign of weakness (No Demand), otherwise false.
N_QuietDoji(_dojiBarMaxBody)
Determines if there is a neutral signal (Quiet Doji).
Parameters:
_dojiBarMaxBody (simple float) : (float) The maximum body percentage for doji bar.
Returns: (bool) True if there is a neutral signal (Quiet Doji), otherwise false.
N_BalancedDoji(_data, _dojiBarMaxBody)
Determines if there is a neutral signal (Balanced Doji).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_dojiBarMaxBody (simple float) : (float) The maximum body percentage for doji bar.
Returns: (bool) True if there is a neutral signal (Balanced Doji), otherwise false.
N_StrongDoji(_dojiBarMaxBody)
Determines if there is a neutral signal (Strong Doji).
Parameters:
_dojiBarMaxBody (simple float) : (float) The maximum body percentage for doji bar.
Returns: (bool) True if there is a neutral signal (Strong Doji), otherwise false.
N_QuietSpinningTop(_spinningTopBarMinWicks, _spinningTopBarEmaLength)
Determines if there is a neutral signal (Quiet Spinning Top).
Parameters:
_spinningTopBarMinWicks (simple float) : (float) The minimum wicks percentage for spinning top bar.
_spinningTopBarEmaLength (simple int) : (int) The length for EMA calculation.
Returns: (bool) True if there is a neutral signal (Quiet Spinning Top), otherwise false.
N_BalancedSpinningTop(_data, _spinningTopBarMinWicks, _spinningTopBarEmaLength)
Determines if there is a neutral signal (Balanced Spinning Top).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_spinningTopBarMinWicks (simple float) : (float) The minimum wicks percentage for spinning top bar.
_spinningTopBarEmaLength (simple int) : (int) The length for EMA calculation.
Returns: (bool) True if there is a neutral signal (Balanced Spinning Top), otherwise false.
N_StrongSpinningTop(_spinningTopBarMinWicks, _spinningTopBarEmaLength)
Determines if there is a neutral signal (Strong Spinning Top).
Parameters:
_spinningTopBarMinWicks (simple float) : (float) The minimum wicks percentage for spinning top bar.
_spinningTopBarEmaLength (simple int) : (int) The length for EMA calculation.
Returns: (bool) True if there is a neutral signal (Strong Spinning Top), otherwise false.
N_QuietHighWave(_highWaveBarMinBody, _highWaveBarMinWick, _highWaveBarBars)
Determines if there is a neutral signal (Quiet High Wave).
Parameters:
_highWaveBarMinBody (simple float) : (float) The minimum body percentage for high wave bar.
_highWaveBarMinWick (simple float) : (float) The minimum wick percentage for high wave bar.
_highWaveBarBars (simple int) : (int) The number of bars for comparison.
Returns: (bool) True if there is a neutral signal (Quiet High Wave), otherwise false.
N_BalancedHighWave(_data, _highWaveBarMinBody, _highWaveBarMinWick, _highWaveBarBars)
Determines if there is a neutral signal (Balanced High Wave).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_highWaveBarMinBody (simple float) : (float) The minimum body percentage for high wave bar.
_highWaveBarMinWick (simple float) : (float) The minimum wick percentage for high wave bar.
_highWaveBarBars (simple int) : (int) The number of bars for comparison.
Returns: (bool) True if there is a neutral signal (Balanced High Wave), otherwise false.
N_StrongHighWave(_highWaveBarMinBody, _highWaveBarMinWick, _highWaveBarBars)
Determines if there is a neutral signal (Strong High Wave).
Parameters:
_highWaveBarMinBody (simple float) : (float) The minimum body percentage for high wave bar.
_highWaveBarMinWick (simple float) : (float) The minimum wick percentage for high wave bar.
_highWaveBarBars (simple int) : (int) The number of bars for comparison.
Returns: (bool) True if there is a neutral signal (Strong High Wave), otherwise false.
N_Consolidation(_data, _consolidationBarSpread, _consolidationBarBars)
Determines if there is a neutral signal (Consolidation).
Parameters:
_data (map) : (map) The data map with volume and spread levels.
_consolidationBarSpread (simple float) : (float) The spread percentage for consolidation bar.
_consolidationBarBars (simple int) : (int) The number of bars for comparison.
Returns: (bool) True if there is a neutral signal (Consolidation), otherwise false.
Price Ratio Indicator [ChartPrime]The Price Ratio Indicator is a versatile tool designed to analyze the relationship between the price of an asset and its moving average. It helps traders identify overbought and oversold conditions in the market, as well as potential trend reversals.
◈ User Inputs:
MA Length: Specifies the length of the moving average used in the calculation.
MA Type Fast: Allows users to choose from various types of moving averages such as Exponential Moving Average (EMA), Simple Moving Average (SMA), Weighted Moving Average (WMA), Volume Weighted Moving Average (VWMA), Relative Moving Average (RMA), Double Exponential Moving Average (DEMA), Triple Exponential Moving Average (TEMA), Zero-Lag Exponential Moving Average (ZLEMA), and Hull Moving Average (HMA).
Upper Level and Lower Level: Define the threshold levels for identifying overbought and oversold conditions.
Signal Line Length: Determines the length of the signal line used for smoothing the indicator's values.
◈ Indicator Calculation:
The indicator calculates the ratio between the price of the asset and the selected moving average, subtracts 1 from the ratio, and then smooths the result using the chosen signal line length.
// 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
//@ Moving Average's Function
ma(src, ma_period, ma_type) =>
ma =
ma_type == 'EMA' ? ta.ema(src, ma_period) :
ma_type == 'SMA' ? ta.sma(src, ma_period) :
ma_type == 'WMA' ? ta.wma(src, ma_period) :
ma_type == 'VWMA' ? ta.vwma(src, ma_period) :
ma_type == 'RMA' ? ta.rma(src, ma_period) :
ma_type == 'DEMA' ? ta.ema(ta.ema(src, ma_period), ma_period) :
ma_type == 'TEMA' ? ta.ema(ta.ema(ta.ema(src, ma_period), ma_period), ma_period) :
ma_type == 'ZLEMA' ? ta.ema(src + src - src , ma_period) :
ma_type == 'HMA' ? ta.hma(src, ma_period)
: na
ma
//@ Smooth of Source
src = math.sum(source, 5)/5
//@ Ratio Price / MA's
p_ratio = src / ma(src, ma_period, ma_type) - 1
◈ Visualization:
The main plot displays the price ratio, with color gradients indicating the strength and direction of the ratio.
The bar color changes dynamically based on the ratio, providing a visual representation of market conditions.
Invisible Horizontal lines indicate the upper and lower threshold levels for overbought and oversold conditions.
A signal line, smoothed using the specified length, helps identify trends and potential reversal points.
High and low value regions are filled with color gradients, enhancing visualization of extreme price movements.
MA type HMA gives faster changes of the indicator (Each MA has its own specifics):
MA type TEMA:
◈ Additional Features:
A symbol displayed at the bottom right corner of the chart provides a quick visual reference to the current state of the indicator, with color intensity indicating the strength of the ratio.
Overall, the Price Ratio Indicator offers traders valuable insights into price dynamics and helps them make informed trading decisions based on the relationship between price and moving averages. Adjusting the input parameters allows for customization according to individual trading preferences and market conditions.
[BT] NedDavis Series: CPI Minus 5-Year Moving Average🟧 GENERAL
The script works on the Monthly Timeframe and has 2 main settings (explained in FEATURES ). It uses the US CPI data, reported by the Bureau of Labour Statistics.
🔹Functionality 1: The main idea is to plot the distance between the CPI line and the 5 year moving average of the CPI line. This technique in mathematics is called "deviation from the moving average". This technique is used to analyse how has CPI previously acted and can give clues at what it might do in the future. Economic historians use such analysis, together with specific period analysis to predict potential risks in the future (see an example of such analysis in HOW TO USE section. The mathematical technique is a simple subtraction between 2 points (CPI - 5yr SMA of CPI).
▶︎Interpretation for deviation from a moving average:
Positive Deviation: When the line is above its moving average, it indicates that the current value is higher than the average, suggesting potential strength or bullish sentiment.
Negative Deviation: Conversely, when the line falls below its moving average, it suggests weakness or bearish sentiment as the current value is lower than the average.
▶︎Applications:
Trend Identification: Deviations from moving averages can help identify trends, with sustained deviations indicating strong trends.
Reversal Signals: Significant deviations from moving averages may signal potential trend reversals, especially when combined with other technical indicators.
Volatility Measurement: Monitoring the magnitude of deviations can provide insights into market volatility and price movements.
Remember the indicator is applying this only for the US CPI - not the ticker you apply the indicator on!
🔹Functionality 2: It plots on a new pane below information about the Consumer Price Index. You can also find the information by plotting the ticker symbol USACPIALLMINMEI on TradingView, which is a Monthly economic data by the OECD for the CPI in the US. The only addition you would get from the indicator is the plot of the 5 year Simple Moving Average.
🔹What is the US Consumer Price Index?
Measures the change in the price of goods and services purchased by consumers;
Traders care about the CPI because consumer prices account for a majority of overall inflation. Inflation is important to currency valuation because rising prices lead the central bank to raise interest rates out of respect for their inflation containment mandate;
It is measured as the average price of various goods and services are sampled and then compared to the previous sampling.
Source: Bureau of Labor Statistics;
FEATURES OF INDICATOR
1) The US Consumer Price Index Minus the Five Year Moving Average of the same.
As shown on the picture above and explained in previous section. Here a more detailed view.
2) The actual US Consumer Price Index (Annual Rate of change) and the Five year average of the US Consumer Price Index. Explained above and shown below:
To activate 2) go into settings and toggle the check box.
HOW TO USE
It can be used for a fundamental analysis on the relationship between the stock market, the economy and the Feds decisions to hike or cut rates, whose main mandate is to control inflation over time.
I have created this indicator to show my analysis in this idea:
What does a First Fed Rate cut really mean?
CREDITS
I have seen such idea in the past posted by the institutional grade research of NedDavis and have recreated it for the TradingView platform, open-source for the community.
Price alert multi symbols (Miu)This indicator won't plot anything to the chart.
Please follow steps below to set your alarms based on multiple symbols' prices:
1) Add indicator to the chart
2) Go to settings
3) Check symbols you want to receive alerts (choose up to 8 different symbols)
4) Set price for each symbol
5) Once all is set go back to the chart and click on 3 dots to set alert in this indicator, rename your alert and confirm
6) You can remove indicator after alert is set and it'll keep working as expected
What does this indicator do?
This indicator will generate alerts based on following conditions:
- If price set is met for any symbol
Once condition is met it will send an alert with the following information:
- Symbol name (e.g: BTC, ETH, LTC)
- Price reached
This script requests current price for each symbol through request.security() built-in function. It also requests amount of digits (mintick) for each symbol to send alerts with correct value.
This script was developed to attend a demand from a comment in other published script.
Feel free to give feedbacks on comments section below.
Enjoy!
Price Based Z-Trend - Strategy [presentTrading]█ Introduction and How it is Different
Z-score: a statistical measurement of a score's relationship to the mean in a group of scores.
Simple but effective approach.
The "Price Based Z-Trend - Strategy " leverages the Z-score, a statistical measure that gauges the deviation of a price from its moving average, normalized against its standard deviation. This strategy stands out due to its simplicity and effectiveness, particularly in markets where price movements often revert to a mean. Unlike more complex systems that might rely on a multitude of indicators, the Z-Trend strategy focuses on clear, statistically significant price movements, making it ideal for traders who prefer a streamlined, data-driven approach.
BTCUSD 6h LS Performance
█ Strategy, How It Works: Detailed Explanation
🔶 Calculation of the Z-score
"Z-score is a statistical measurement that describes a value's relationship to the mean of a group of values. Z-score is measured in terms of standard deviations from the mean. If a Z-score is 0, it indicates that the data point's score is identical to the mean score. A Z-score of 1.0 would indicate a value that is one standard deviation from the mean. Z-scores may be positive or negative, with a positive value indicating the score is above the mean and a negative score indicating it is below the mean."
The Z-score is central to this strategy. It is calculated by taking the difference between the current price and the Exponential Moving Average (EMA) of the price over a user-defined length, then dividing this by the standard deviation of the price over the same length:
z = (x - μ) /σ
Local
🔶 Trading Signals
Trading signals are generated based on the Z-score crossing predefined thresholds:
- Long Entry: When the Z-score crosses above the positive threshold.
- Long Exit: When the Z-score falls below the negative threshold.
- Short Entry: When the Z-score falls below the negative threshold.
- Short Exit: When the Z-score rises above the positive threshold.
█ Trade Direction
The strategy allows users to select their preferred trading direction through an input option.
█ Usage
To use this strategy effectively, traders should first configure the Z-score thresholds according to their risk tolerance and market volatility. It's also crucial to adjust the length for the EMA and standard deviation calculations based on historical performance and the expected "noise" in price data.
The strategy is designed to be flexible, allowing traders to refine settings to better capture profitable opportunities in specific market conditions.
█ Default Settings
- Trade Direction: Both
- Standard Deviation Length: 100
- Average Length: 100
- Threshold for Z-score: 1.0
- Bar Color Indicator: Enabled
These settings offer a balanced starting point but can be customized to suit various trading styles and market environments. The strategy's parameters are designed to be adjusted as traders gain experience and refine their approach based on ongoing market analysis.
Z-score is a must-learn approach for every algorithmic trader.
Gaussian Price Filter [BackQuant]Gaussian Price Filter
Overview and History of the Gaussian Transformation
The Gaussian transformation, often associated with the Gaussian (normal) distribution, is a mathematical function characteristically prominent in statistics and probability theory. The bell-shaped curve of the Gaussian function, expressing the normal distribution, is ubiquitously employed in various scientific and engineering disciplines, including financial market analysis. This transformation's core utility in trading and economic forecasting is derived from its efficacy in smoothing data series and highlighting underlying trends, which are pivotal for making strategic trading decisions.
The Gaussian filter, specifically, is a type of data-smoothing algorithm that mitigates the random "noise" of market price data, thus enhancing the visibility of crucial trend changes and patterns. Historically, this concept was adapted from fields such as signal processing and image editing, where precise extraction of useful information from noisy environments is critical.
1. What is a Gaussian Transformation?
A Gaussian transformation involves the application of a Gaussian function to a set of data points. The function is applied as a filter in the context of trading algorithms to smooth time series data, which helps in identifying the intrinsic trends obscured by market volatility. The transformation is characterized by its parameter, sigma (σ), representing the standard deviation, which determines the width of the Gaussian bell curve. The breadth of this curve impacts the degree of smoothing: a wider curve (higher sigma value) results in more smoothing, beneficial for longer-term trend analysis.
2. Filtering Price with Gaussian Transformation and its Benefits
In the provided Script, the Gaussian transformation is utilized to filter price data. The filtering process involves convolving the price data with Gaussian weights, which are calculated based on the chosen length (the number of data points considered) and sigma. This convolution process smooths out short-term fluctuations and highlights longer-term movements, facilitating a clearer analysis of market trends.
Benefits:
Reduces noise: It filters out minor price movements and random fluctuations, which are often misleading.
Enhances trend recognition: By smoothing the data, it becomes easier to identify significant trends and reversals.
Improves decision-making: Traders can make more informed decisions by focusing on substantive, smoothed data rather than reacting to random noise.
3. Potential Limitations and Issues
While Gaussian filters are highly effective in smoothing data, they are not without limitations:
Lag introduction: Like all moving averages, the Gaussian filter introduces a lag between the actual price movements and the output signal, which can delay decision-making.
Feature blurring: Over-smoothing might obscure significant price movements, especially if a large sigma is used.
Parameter sensitivity: The choice of length and sigma significantly affects the output, requiring optimization and backtesting to determine the best settings for specific market conditions.
4. Extending Gaussian Filters to Other Indicators
The methodology used to filter price data with a Gaussian filter can similarly be applied to other technical indicators, such as RSI (Relative Strength Index) or MACD (Moving Average Convergence Divergence). By smoothing these indicators, traders can reduce false signals and enhance the reliability of the indicators' outputs, leading to potentially more accurate signals and better timing for entering or exiting trades.
5. Application in Trading
In trading, the Gaussian Price Filter can be strategically used to:
Spot trend reversals: Smoothed price data can more clearly indicate when a trend is starting to change, which is crucial for catching reversals early.
Define entry and exit points: The filtered data points can help in setting more precise entry and exit thresholds, minimizing the risk and maximizing the potential return.
Filter other data streams: Apply the Gaussian filter on volume or open interest data to identify significant changes in market dynamics.
6. Functionality of the Script
The script is designed to:
Calculate Gaussian weights (f_gaussianWeights function): Generates the weights used for the Gaussian kernel based on the provided length and sigma.
Apply the Gaussian filter (f_applyGaussianFilter function): Uses the weights to compute the smoothed price data.
Conditional Trend Detection and Coloring: Determines the trend direction based on the filtered price and colors the price bars on the chart to visually represent the trend.
7. Specific Actions of This Code
The Pine Script provided by BackQuant executes several specific actions:
Input Handling: It allows users to specify the source data (src), kernel length, and sigma directly in the chart settings.
Weight Calculation and Normalization: Computes the Gaussian weights and normalizes them to ensure their sum equals one, which maintains the original data scale.
Filter Application: Applies the normalized Gaussian kernel to the price data to produce a smoothed output.
Trend Identification and Visualization: Identifies whether the market is trending upwards or downwards based on the smoothed data and colors the bars green (up) or red (down) to indicate the trend direction.